#include "patterns.h"
#include "util.h"
#include<cstdio>
// #define POS(i, j) ((i) * board_size + (j))
// #define I(pos) ((pos) / board_size)
// #define J(pos) ((pos) % board_size)

//extern int board_size;

int codes[]={262,
265,281,294,297,326,329,342,345,358,361,390,393,406,409,422,425,518,521,534,537,550,582,585,598,601,614,617,646,649,662,665,678,681,1312,1313,1314,1316,1317,1318,1320,1321,1322,1350,1350,1352,1353,1354,1366,1366,1368,1369,1370,1380,1380,1381,1381,1382,1382,1382,1382,1384,1385,1386,1417,1433,1444,1445,1446,1449,1568,1569,1570,1572,1573,1574,1576,1577,1578,1606,1606,1608,1609,1610,1622,1622,1624,1625,1626,1636,1636,1637,1637,1638,1638,1638,1638,1640,1641,1642,1673,
1689,1700,1701,1702,1705,2320,2321,2322,2324,2325,2326,2328,2329,2330,2374,2390,2392,2393,2394,2406,2436,2437,2438,2441,2441,2452,2453,2454,2456,2456,2457,2457,2457,2457,2458,2458,2468,2469,2470,2473,2473,2576,2577,2578,2580,2581,2582,2584,2585,2586,2630,2646,2648,2649,2650,2662,2692,2693,2694,2697,2697,2708,2709,2710,2712,2712,2713,2713,2713,2713,2714,2714,2724,2725,2726,2729,2729,4358,4361,4377,4390,4393,4422,4425,4438,4441,4454,4457,4480,4481,4482,4486,4489,4496,4497,4498,4502,4505,4512,4513,
4514,4518,4521,4614,4617,4630,4633,4646,4678,4681,4694,4697,4710,4713,4736,4737,4742,4745,4752,4753,4758,4761,4768,4769,4774,4777,5408,5409,5410,5412,5413,5414,5416,5417,5418,5446,5446,5462,5462,5476,5476,5477,5477,5478,5478,5478,5478,5505,5513,5521,5529,5537,5540,5541,5542,5545,5664,5665,5666,5668,5669,5670,5672,5673,5674,5702,5702,5718,5718,5732,5732,5733,5733,5734,5734,5734,5734,5761,5769,5777,5785,5793,5796,5797,5798,5801,6416,6417,6418,6420,6421,6422,6424,6425,6426,6470,6486,6488,6489,6490,
6502,6529,6532,6533,6534,6537,6537,6545,6548,6549,6550,6552,6552,6553,6553,6553,6553,6554,6554,6561,6564,6565,6566,6569,6569,6672,6673,6674,6676,6677,6678,6680,6681,6682,6726,6742,6744,6745,6746,6758,6785,6788,6789,6790,6793,6793,6801,6804,6805,6806,6808,6808,6809,6809,6809,6809,6810,6810,6817,6820,6821,6822,6825,6825,8454,8457,8473,8486,8489,8512,8514,8518,8521,8528,8530,8534,8537,8544,8546,8550,8553,8582,8585,8598,8601,8614,8617,8710,8713,8726,8729,8742,8768,8769,8770,8774,8777,8784,8785,8786,
8790,8793,8800,8801,8802,8806,8809,8838,8841,8854,8857,8870,8873,9504,9505,9506,9508,9509,9510,9512,9513,9514,9538,9542,9542,9544,9545,9546,9554,9558,9558,9560,9561,9562,9570,9572,9572,9573,9573,9574,9574,9574,9574,9576,9577,9578,9609,9625,9636,9637,9638,9641,9760,9761,9762,9764,9765,9766,9768,9769,9770,9794,9798,9798,9800,9801,9802,9810,9814,9814,9816,9817,9818,9826,9828,9828,9829,9829,9830,9830,9830,9830,9832,9833,9834,9865,9881,9892,9893,9894,9897,10512,10513,10514,10516,10517,10518,10520,10521,10522,
10562,10566,10578,10582,10584,10585,10586,10594,10598,10633,10633,10648,10648,10649,10649,10649,10649,10650,10650,10665,10665,10768,10769,10770,10772,10773,10774,10776,10777,10778,10818,10822,10834,10838,10840,10841,10842,10850,10854,10889,10889,10904,10904,10905,10905,10905,10905,10906,10906,10921,10921,12763,12775,13019,13031,16665,16678,16710,16710,16726,16726,16742,16742,16772,16773,16774,16777,16793,16804,16805,16806,16809,16831,16921,16934,16966,16966,16982,16982,16998,16998,17028,17029,17030,17033,17049,17060,17061,17062,17065,17087,17700,17700,17701,17701,17702,17702,17734,17750,17764,
17765,17766,17766,17801,17817,17828,17829,17830,17833,17956,17956,17957,17957,17958,17958,17990,18006,18020,18021,18022,18022,18057,18073,18084,18085,18086,18089,18692,18694,18708,18710,18712,18713,18714,18724,18726,18758,18774,18776,18777,18778,18790,18816,18817,18820,18820,18820,18820,18821,18821,18821,18822,18822,18822,18825,18832,18833,18836,18836,18836,18837,18837,18838,18838,18840,18841,18841,18842,18852,18852,18852,18853,18853,18854,18854,18854,18857,18879,18948,18950,18964,18966,18968,18969,18970,18980,18982,19014,19030,19032,19033,19034,19046,19072,19073,19076,19076,19076,19076,19077,
19077,19077,19078,19078,19078,19081,19088,19089,19092,19092,19092,19093,19093,19094,19094,19096,19097,19097,19098,19108,19108,19108,19109,19109,19110,19110,19110,19113,19135,20761,20774,20806,20806,20822,20822,20838,20838,20864,20865,20866,20868,20869,20870,20873,20880,20881,20882,20889,20896,20897,20898,20900,20901,20902,20905,20927,21017,21030,21062,21062,21078,21078,21094,21094,21120,21121,21122,21124,21125,21126,21129,21136,21137,21138,21145,21152,21153,21154,21156,21157,21158,21161,21183,21796,21796,21797,21797,21798,21798,21830,21846,21860,21861,21862,21862,21897,21913,21924,21925,21926,
21929,22052,22052,22053,22053,22054,22054,22086,22102,22116,22117,22118,22118,22153,22169,22180,22181,22182,22185,22808,22809,22810,22854,22870,22872,22873,22874,22886,22912,22913,22916,22916,22916,22917,22917,22917,22918,22918,22921,22928,22929,22932,22932,22933,22933,22934,22936,22937,22937,22938,22948,22948,22949,22949,22950,22950,22953,22975,23064,23065,23066,23110,23126,23128,23129,23130,23142,23168,23169,23172,23172,23172,23173,23173,23173,23174,23174,23177,23184,23185,23188,23188,23189,23189,23190,23192,23193,23193,23194,23204,23204,23205,23205,23206,23206,23209,23231,24857,24870,24895,
24896,24897,24898,24900,24900,24901,24901,24902,24902,24902,24902,24904,24905,24906,24912,24913,24914,24916,24916,24917,24917,24918,24918,24918,24918,24920,24921,24922,24928,24929,24930,24932,24932,24933,24933,24934,24934,24934,24934,24936,24937,24938,24959,24964,24965,24966,24969,24985,24996,24997,24998,25001,25023,25023,25113,25126,25151,25152,25153,25154,25156,25156,25157,25157,25158,25158,25158,25158,25160,25161,25162,25168,25169,25170,25172,25172,25173,25173,25174,25174,25174,25174,25176,25177,25178,25184,25185,25186,25188,25188,25189,25189,25190,25190,25190,25190,25192,25193,25194,25220,
25221,25222,25225,25241,25252,25253,25254,25257,25279,25279,25892,25892,25893,25893,25894,25894,25919,25920,25920,25921,25921,25922,25922,25924,25925,25926,25926,25928,25929,25930,25936,25936,25937,25937,25938,25938,25940,25941,25942,25942,25944,25945,25946,25952,25952,25953,25953,25954,25954,25956,25956,25957,25957,25958,25958,25958,25960,25961,25962,25983,25993,26009,26020,26021,26022,26025,26047,26148,26148,26149,26149,26150,26150,26175,26176,26176,26177,26177,26178,26178,26180,26181,26182,26182,26184,26185,26186,26192,26192,26193,26193,26194,26194,26196,26197,26198,26198,26200,26201,26202,
26208,26208,26209,26209,26210,26210,26212,26212,26213,26213,26214,26214,26214,26216,26217,26218,26249,26265,26276,26277,26278,26281,26303,26884,26886,26900,26902,26904,26905,26906,26916,26918,26943,26944,26945,26946,26948,26949,26950,26950,26952,26953,26954,26960,26961,26962,26964,26965,26966,26966,26968,26968,26969,26969,26970,26970,26976,26977,26978,26980,26981,26982,26982,26984,26985,26986,27007,27008,27009,27012,27012,27012,27013,27013,27014,27014,27017,27024,27025,27028,27028,27029,27030,27032,27033,27033,27034,27044,27044,27045,27046,27046,27049,27071,27071,27140,27142,27156,27158,27160,
27161,27162,27172,27174,27199,27200,27201,27202,27204,27205,27206,27206,27208,27209,27210,27216,27217,27218,27220,27221,27222,27222,27224,27224,27225,27225,27226,27226,27232,27233,27234,27236,27237,27238,27238,27240,27241,27242,27263,27264,27265,27268,27268,27268,27269,27269,27270,27270,27273,27280,27281,27284,27284,27285,27286,27288,27289,27289,27290,27300,27300,27301,27302,27302,27305,27327,27327,29147,29159,29403,29415,31171,31175,31187,31191,31203,31207,31427,31431,31443,31447,31459,31463,33049,33062,33094,33096,33097,33098,33110,33112,33113,33114,33126,33151,33161,33161,33177,33177,33193,
33193,33305,33318,33350,33352,33353,33354,33366,33368,33369,33370,33382,33407,33417,33417,33433,33433,33449,33449,34056,34057,34072,34073,34084,34085,34086,34088,34089,34112,34114,34118,34120,34120,34120,34120,34121,34121,34121,34122,34122,34122,34134,34136,34136,34136,34137,34137,34137,34138,34138,34144,34146,34148,34149,34150,34150,34152,34152,34152,34153,34153,34154,34154,34175,34185,34201,34212,34213,34214,34217,34312,34313,34328,34329,34340,34341,34342,34344,34345,34368,34370,34374,34376,34376,34376,34376,34377,34377,34377,34378,34378,34378,34390,34392,34392,34392,34393,34393,34393,34394,
34394,34400,34402,34404,34405,34406,34406,34408,34408,34408,34409,34409,34410,34410,34431,34441,34457,34468,34469,34470,34473,35096,35096,35097,35097,35098,35098,35142,35158,35160,35161,35162,35174,35209,35224,35225,35225,35226,35241,35352,35352,35353,35353,35354,35354,35398,35414,35416,35417,35418,35430,35465,35480,35481,35481,35482,35497,37145,37158,37183,37190,37192,37193,37194,37206,37208,37209,37210,37222,37247,37247,37248,37249,37250,37252,37253,37254,37256,37256,37257,37257,37257,37257,37258,37258,37264,37265,37266,37268,37269,37270,37272,37272,37273,37273,37273,37273,37274,37274,37280,
37281,37282,37284,37285,37286,37288,37288,37289,37289,37289,37289,37290,37290,37401,37414,37439,37446,37448,37449,37450,37462,37464,37465,37466,37478,37503,37503,37504,37505,37506,37508,37509,37510,37512,37512,37513,37513,37513,37513,37514,37514,37520,37521,37522,37524,37525,37526,37528,37528,37529,37529,37529,37529,37530,37530,37536,37537,37538,37540,37541,37542,37544,37544,37545,37545,37545,37545,37546,37546,37567,38152,38153,38168,38169,38180,38181,38182,38184,38185,38207,38208,38210,38214,38216,38216,38216,38217,38217,38218,38218,38230,38232,38232,38233,38233,38234,38240,38242,38244,38245,
38246,38246,38248,38248,38249,38250,38271,38271,38272,38273,38274,38276,38277,38278,38280,38281,38281,38282,38288,38289,38290,38292,38293,38294,38296,38297,38297,38298,38304,38305,38306,38308,38308,38309,38309,38310,38310,38312,38313,38313,38314,38335,38408,38409,38424,38425,38436,38437,38438,38440,38441,38463,38464,38466,38470,38472,38472,38472,38473,38473,38474,38474,38486,38488,38488,38489,38489,38490,38496,38498,38500,38501,38502,38502,38504,38504,38505,38506,38527,38527,38528,38529,38530,38532,38533,38534,38536,38537,38537,38538,38544,38545,38546,38548,38549,38550,38552,38553,38553,38554,
38560,38561,38562,38564,38564,38565,38565,38566,38566,38568,38569,38569,38570,38591,39192,39192,39193,39193,39194,39194,39231,39238,39254,39256,39257,39258,39270,39295,39296,39296,39297,39297,39298,39298,39300,39301,39302,39304,39305,39305,39306,39312,39312,39313,39313,39314,39314,39316,39317,39318,39320,39320,39321,39321,39321,39322,39322,39328,39328,39329,39329,39330,39330,39332,39333,39334,39336,39337,39337,39338,39448,39448,39449,39449,39450,39450,39487,39494,39510,39512,39513,39514,39526,39551,39552,39552,39553,39553,39554,39554,39556,39557,39558,39560,39561,39561,39562,39568,39568,39569,
39569,39570,39570,39572,39573,39574,39576,39576,39577,39577,39577,39578,39578,39584,39584,39585,39585,39586,39586,39588,39589,39590,39592,39593,39593,39594,39615,41241,41254,41280,41281,41282,41286,41288,41289,41290,41296,41297,41298,41302,41304,41305,41306,41312,41313,41314,41318,41343,41353,41353,41369,41369,41385,41385,41497,41510,41536,41537,41538,41542,41544,41545,41546,41552,41553,41554,41558,41560,41561,41562,41568,41569,41570,41574,41599,41609,41609,41625,41625,41641,41641,42276,42277,42278,42304,42306,42310,42312,42312,42312,42313,42313,42314,42314,42314,42326,42328,42328,42329,42329,
42330,42330,42336,42338,42340,42341,42342,42342,42344,42344,42345,42346,42346,42367,42377,42393,42404,42405,42406,42409,42532,42533,42534,42560,42562,42566,42568,42568,42568,42569,42569,42570,42570,42570,42582,42584,42584,42585,42585,42586,42586,42592,42594,42596,42597,42598,42598,42600,42600,42601,42602,42602,42623,42633,42649,42660,42661,42662,42665,43288,43288,43289,43289,43290,43290,43334,43350,43352,43353,43354,43366,43401,43416,43417,43417,43418,43433,43544,43544,43545,43545,43546,43546,43590,43606,43608,43609,43610,43622,43657,43672,43673,43673,43674,43689,45531,45543,45787,45799,46531,
46539,46547,46555,46563,46571,46787,46795,46803,46811,46819,46827,65798,65801,65817,65830,65833,65862,65865,65878,65881,65894,65897,65926,65929,65942,65945,65958,65961,66054,66057,66070,66073,66086,66118,66121,66134,66137,66150,66153,66182,66185,66198,66201,66214,66217,66852,66853,66854,66856,66857,66858,66886,66886,66902,66902,66916,66916,66917,66917,66918,66918,66918,66918,66953,66969,66980,66981,66982,66985,67104,67105,67106,67108,67109,67110,67112,67113,67114,67142,67142,67158,67158,67172,67172,67173,67173,67174,67174,67174,67174,67209,67225,67236,67237,67238,67241,67856,67857,67858,67860,
67861,67862,67864,67865,67866,67903,67910,67920,67921,67922,67926,67928,67929,67930,67942,67967,67972,67973,67974,67977,67977,67984,67985,67986,67988,67989,67990,67992,67992,67993,67993,67993,67993,67994,67994,68004,68005,68006,68009,68009,68031,68112,68113,68114,68116,68117,68118,68120,68121,68122,68159,68166,68176,68177,68178,68182,68184,68185,68186,68198,68223,68228,68229,68230,68233,68233,68240,68241,68242,68244,68245,68246,68248,68248,68249,68249,68249,68249,68250,68250,68260,68261,68262,68265,68265,68287,69894,69897,69913,69926,69929,69958,69961,69974,69977,69990,69993,70016,70017,70018,
70022,70025,70032,70033,70034,70038,70041,70048,70049,70050,70054,70057,70150,70153,70166,70169,70182,70214,70217,70230,70233,70246,70249,70272,70273,70278,70281,70288,70289,70294,70297,70304,70305,70310,70313,70948,70949,70950,70952,70953,70954,70982,70982,70998,70998,71012,71012,71013,71013,71014,71014,71014,71014,71041,71049,71057,71065,71073,71076,71077,71078,71081,71200,71201,71202,71204,71205,71206,71208,71209,71210,71238,71238,71254,71254,71268,71268,71269,71269,71270,71270,71270,71270,71297,71305,71313,71321,71329,71332,71333,71334,71337,71952,71953,71954,71956,71957,71958,71960,71961,
71962,71999,72006,72016,72017,72018,72022,72024,72025,72026,72038,72063,72065,72068,72069,72070,72073,72073,72080,72081,72081,72082,72084,72085,72086,72088,72088,72089,72089,72089,72089,72090,72090,72097,72100,72101,72102,72105,72105,72127,72208,72209,72210,72212,72213,72214,72216,72217,72218,72255,72262,72272,72273,72274,72278,72280,72281,72282,72294,72319,72321,72324,72325,72326,72329,72329,72336,72337,72337,72338,72340,72341,72342,72344,72344,72345,72345,72345,72345,72346,72346,72353,72356,72357,72358,72361,72361,72383,73990,73993,74009,74022,74025,74048,74050,74054,74057,74064,74066,74070,
74073,74080,74082,74086,74089,74118,74121,74134,74137,74150,74153,74246,74249,74262,74265,74278,74304,74305,74306,74310,74313,74320,74321,74322,74326,74329,74336,74337,74338,74342,74345,74374,74377,74390,74393,74406,74409,75044,75045,75046,75048,75049,75050,75074,75078,75078,75090,75094,75094,75106,75108,75108,75109,75109,75110,75110,75110,75110,75145,75161,75172,75173,75174,75177,75296,75297,75298,75300,75301,75302,75304,75305,75306,75330,75334,75334,75346,75350,75350,75362,75364,75364,75365,75365,75366,75366,75366,75366,75401,75417,75428,75429,75430,75433,76048,76049,76050,76052,76053,76054,
76056,76057,76058,76095,76098,76102,76112,76113,76114,76114,76118,76120,76121,76122,76130,76134,76159,76169,76169,76176,76177,76178,76184,76184,76185,76185,76185,76185,76186,76186,76201,76201,76223,76304,76305,76306,76308,76309,76310,76312,76313,76314,76351,76354,76358,76368,76369,76370,76370,76374,76376,76377,76378,76386,76390,76415,76425,76425,76432,76433,76434,76440,76440,76441,76441,76441,76441,76442,76442,76457,76457,76479,78299,78311,78555,78567,80323,80327,80331,80339,80343,80347,80355,80359,80363,80579,80583,80587,80595,80599,80603,80611,80615,80619,82201,82214,82246,82246,82262,82262,
82278,82278,82313,82329,82345,82367,82457,82470,82502,82502,82518,82518,82534,82534,82569,82585,82601,82623,83236,83236,83237,83237,83238,83238,83270,83286,83300,83301,83302,83302,83337,83353,83364,83365,83366,83369,83492,83492,83493,83493,83494,83494,83526,83542,83556,83557,83558,83558,83593,83609,83620,83621,83622,83625,84228,84230,84244,84246,84248,84249,84250,84260,84262,84294,84310,84312,84313,84314,84326,84352,84353,84356,84356,84356,84357,84357,84358,84358,84361,84368,84369,84372,84372,84372,84373,84373,84374,84374,84376,84377,84377,84378,84388,84388,84389,84390,84390,84393,84415,84484,
84486,84500,84502,84504,84505,84506,84516,84518,84550,84566,84568,84569,84570,84582,84608,84609,84612,84612,84612,84613,84613,84614,84614,84617,84624,84625,84628,84628,84628,84629,84629,84630,84630,84632,84633,84633,84634,84644,84644,84645,84646,84646,84649,84671,86297,86310,86342,86342,86358,86358,86374,86374,86400,86401,86402,86409,86416,86417,86418,86425,86432,86433,86434,86441,86463,86553,86566,86598,86598,86614,86614,86630,86630,86656,86657,86658,86665,86672,86673,86674,86681,86688,86689,86690,86697,86719,87332,87332,87333,87333,87334,87334,87366,87382,87396,87397,87398,87398,87433,87449,
87460,87461,87462,87465,87588,87588,87589,87589,87590,87590,87622,87638,87652,87653,87654,87654,87689,87705,87716,87717,87718,87721,88344,88345,88346,88390,88406,88408,88409,88410,88422,88448,88449,88452,88452,88453,88453,88454,88457,88464,88465,88468,88468,88469,88469,88470,88472,88473,88473,88474,88484,88485,88486,88489,88511,88600,88601,88602,88646,88662,88664,88665,88666,88678,88704,88705,88708,88708,88709,88709,88710,88713,88720,88721,88724,88724,88725,88725,88726,88728,88729,88729,88730,88740,88741,88742,88745,88767,90393,90406,90431,90432,90433,90434,90436,90436,90437,90437,90438,90438,
90438,90438,90440,90441,90442,90448,90449,90450,90452,90452,90453,90453,90454,90454,90454,90454,90456,90457,90458,90464,90465,90466,90468,90468,90469,90469,90470,90470,90470,90470,90472,90473,90474,90495,90505,90521,90537,90559,90559,90649,90662,90687,90688,90689,90690,90692,90692,90693,90693,90694,90694,90694,90694,90696,90697,90698,90704,90705,90706,90708,90708,90709,90709,90710,90710,90710,90710,90712,90713,90714,90720,90721,90722,90724,90724,90725,90725,90726,90726,90726,90726,90728,90729,90730,90761,90777,90793,90815,90815,91428,91428,91429,91429,91430,91430,91455,91456,91456,91457,91457,
91458,91458,91460,91461,91462,91462,91464,91465,91466,91472,91472,91473,91473,91474,91474,91476,91477,91478,91478,91480,91481,91482,91488,91488,91489,91489,91490,91490,91492,91492,91493,91493,91494,91494,91494,91496,91497,91498,91519,91529,91545,91556,91557,91558,91561,91583,91684,91684,91685,91685,91686,91686,91711,91712,91712,91713,91713,91714,91714,91716,91717,91718,91718,91720,91721,91722,91728,91728,91729,91729,91730,91730,91732,91733,91734,91734,91736,91737,91738,91744,91744,91745,91745,91746,91746,91748,91748,91749,91749,91750,91750,91750,91752,91753,91754,91785,91801,91812,91813,91814,
91817,91839,92420,92422,92436,92438,92440,92441,92442,92452,92454,92479,92480,92481,92482,92484,92485,92486,92486,92488,92489,92490,92496,92497,92498,92500,92501,92502,92502,92504,92504,92505,92505,92506,92506,92512,92513,92514,92516,92517,92518,92518,92520,92521,92522,92543,92544,92545,92548,92548,92549,92550,92553,92560,92561,92564,92564,92565,92566,92568,92569,92569,92570,92580,92582,92585,92607,92607,92676,92678,92692,92694,92696,92697,92698,92708,92710,92735,92736,92737,92738,92740,92741,92742,92742,92744,92745,92746,92752,92753,92754,92756,92757,92758,92758,92760,92760,92761,92761,92762,
92762,92768,92769,92770,92772,92773,92774,92774,92776,92777,92778,92799,92800,92801,92804,92804,92805,92806,92809,92816,92817,92820,92820,92821,92822,92824,92825,92825,92826,92836,92838,92841,92863,92863,94683,94695,94939,94951,96707,96707,96711,96711,96715,96723,96723,96727,96727,96731,96739,96739,96743,96743,96747,96963,96963,96967,96967,96971,96979,96979,96983,96983,96987,96995,96995,96999,96999,97003,98560,98561,98562,98576,98577,98578,98585,98592,98593,98594,98598,98630,98632,98633,98634,98646,98648,98649,98650,98662,98687,98697,98697,98713,98713,98729,98729,98816,98817,98818,98832,98833,
98834,98841,98848,98849,98850,98854,98886,98888,98889,98890,98902,98904,98905,98906,98918,98943,98953,98953,98969,98969,98985,98985,99584,99585,99586,99592,99593,99600,99601,99602,99608,99609,99616,99617,99618,99620,99621,99622,99624,99625,99648,99650,99654,99656,99656,99656,99657,99657,99658,99658,99670,99672,99672,99673,99673,99674,99680,99682,99684,99685,99686,99686,99688,99688,99689,99690,99711,99721,99737,99748,99749,99750,99753,99840,99841,99842,99848,99849,99856,99857,99858,99864,99865,99872,99873,99874,99876,99877,99878,99880,99881,99904,99906,99910,99912,99912,99912,99913,99913,99914,
99914,99926,99928,99928,99929,99929,99930,99936,99938,99940,99941,99942,99942,99944,99944,99945,99946,99967,99977,99993,100004,100005,100006,100009,100608,100609,100610,100612,100613,100614,100616,100616,100617,100617,100618,100618,100624,100625,100626,100628,100629,100630,100632,100632,100632,100632,100633,100633,100633,100633,100634,100634,100634,100634,100640,100641,100642,100644,100645,100646,100648,100648,100649,100649,100650,100650,100672,100673,100674,100676,100677,100678,100678,100680,100681,100682,100688,100689,100690,100692,100693,100694,100694,100696,100696,100697,100697,100698,100698,100704,100705,100706,100708,100709,100710,100710,100712,100713,100714,100736,
100736,100737,100737,100738,100738,100740,100741,100742,100744,100745,100745,100746,100752,100752,100753,100753,100754,100754,100756,100757,100758,100760,100760,100761,100761,100761,100762,100762,100768,100768,100769,100769,100770,100770,100772,100773,100774,100776,100777,100777,100778,100864,100865,100866,100868,100869,100870,100872,100872,100873,100873,100874,100874,100880,100881,100882,100884,100885,100886,100888,100888,100888,100888,100889,100889,100889,100889,100890,100890,100890,100890,100896,100897,100898,100900,100901,100902,100904,100904,100905,100905,100906,100906,100928,100929,100930,100932,100933,100934,100934,100936,100937,100938,100944,100945,100946,100948,100949,100950,100950,
100952,100952,100953,100953,100954,100954,100960,100961,100962,100964,100965,100966,100966,100968,100969,100970,100992,100992,100993,100993,100994,100994,100996,100997,100998,101000,101001,101001,101002,101008,101008,101009,101009,101010,101010,101012,101013,101014,101016,101016,101017,101017,101017,101018,101018,101024,101024,101025,101025,101026,101026,101028,101029,101030,101032,101033,101033,101034,102656,102657,102658,102660,102661,102662,102664,102665,102666,102672,102673,102674,102676,102677,102678,102680,102681,102681,102682,102688,102689,102690,102692,102693,102694,102694,102696,102697,102698,102719,102726,102728,102729,102730,102742,102744,102745,102746,102758,102783,102783,102784,
102785,102786,102788,102789,102790,102792,102792,102793,102793,102793,102793,102794,102794,102800,102801,102802,102804,102805,102806,102808,102808,102809,102809,102809,102809,102810,102810,102816,102817,102818,102820,102821,102822,102824,102824,102825,102825,102825,102825,102826,102826,102912,102913,102914,102916,102917,102918,102920,102921,102922,102928,102929,102930,102932,102933,102934,102936,102937,102937,102938,102944,102945,102946,102948,102949,102950,102950,102952,102953,102954,102975,102982,102984,102985,102986,102998,103000,103001,103002,103014,103039,103039,103040,103041,103042,103044,103045,103046,103048,103048,103049,103049,103049,103049,103050,103050,103056,103057,103058,103060,
103061,103062,103064,103064,103065,103065,103065,103065,103066,103066,103072,103073,103074,103076,103077,103078,103080,103080,103081,103081,103081,103081,103082,103082,103103,103680,103681,103682,103688,103689,103696,103697,103698,103704,103705,103712,103713,103714,103716,103717,103718,103720,103721,103743,103744,103746,103750,103752,103752,103752,103753,103753,103754,103754,103766,103768,103768,103769,103769,103770,103776,103778,103780,103781,103782,103782,103784,103784,103785,103786,103807,103807,103808,103809,103810,103812,103813,103814,103816,103817,103817,103818,103824,103825,103826,103828,103829,103830,103832,103833,103833,103834,103840,103841,103842,103844,103844,103845,103845,103846,
103846,103848,103849,103849,103850,103871,103936,103937,103938,103944,103945,103952,103953,103954,103960,103961,103968,103969,103970,103972,103973,103974,103976,103977,103999,104000,104002,104006,104008,104008,104008,104009,104009,104010,104010,104022,104024,104024,104025,104025,104026,104032,104034,104036,104037,104038,104038,104040,104040,104041,104042,104063,104063,104064,104065,104066,104068,104069,104070,104072,104073,104073,104074,104080,104081,104082,104084,104085,104086,104088,104089,104089,104090,104096,104097,104098,104100,104100,104101,104101,104102,104102,104104,104105,104105,104106,104127,104704,104705,104706,104708,104709,104710,104712,104712,104713,104713,104714,104714,104720,
104721,104722,104724,104725,104726,104728,104728,104728,104728,104729,104729,104729,104729,104730,104730,104730,104730,104736,104737,104738,104740,104741,104742,104744,104744,104745,104745,104746,104746,104767,104768,104769,104770,104772,104773,104774,104774,104776,104777,104778,104784,104785,104786,104788,104789,104790,104790,104792,104792,104793,104793,104794,104794,104800,104801,104802,104804,104805,104806,104806,104808,104809,104810,104831,104832,104832,104832,104832,104833,104833,104833,104833,104834,104834,104834,104834,104836,104836,104837,104837,104838,104838,104840,104840,104841,104841,104841,104842,104842,104848,104848,104848,104848,104849,104849,104849,104849,104850,104850,104850,
104850,104852,104852,104853,104853,104854,104854,104856,104856,104856,104857,104857,104857,104857,104858,104858,104858,104864,104864,104864,104864,104865,104865,104865,104865,104866,104866,104866,104866,104868,104868,104869,104869,104870,104870,104872,104872,104873,104873,104873,104874,104874,104960,104961,104962,104964,104965,104966,104968,104968,104969,104969,104970,104970,104976,104977,104978,104980,104981,104982,104984,104984,104984,104984,104985,104985,104985,104985,104986,104986,104986,104986,104992,104993,104994,104996,104997,104998,105000,105000,105001,105001,105002,105002,105023,105024,105025,105026,105028,105029,105030,105030,105032,105033,105034,105040,105041,105042,105044,105045,
105046,105046,105048,105048,105049,105049,105050,105050,105056,105057,105058,105060,105061,105062,105062,105064,105065,105066,105087,105088,105088,105088,105088,105089,105089,105089,105089,105090,105090,105090,105090,105092,105092,105093,105093,105094,105094,105096,105096,105097,105097,105097,105098,105098,105104,105104,105104,105104,105105,105105,105105,105105,105106,105106,105106,105106,105108,105108,105109,105109,105110,105110,105112,105112,105112,105113,105113,105113,105113,105114,105114,105114,105120,105120,105120,105120,105121,105121,105121,105121,105122,105122,105122,105122,105124,105124,105125,105125,105126,105126,105128,105128,105129,105129,105129,105130,105130,105151,106752,106753,
106754,106768,106769,106770,106777,106784,106785,106786,106790,106816,106817,106818,106822,106824,106825,106826,106832,106833,106834,106838,106840,106841,106842,106848,106849,106850,106854,106879,106889,106889,106905,106905,106921,106921,107033,107046,107072,107073,107074,107078,107080,107081,107082,107088,107089,107090,107094,107096,107097,107098,107104,107105,107106,107110,107135,107145,107145,107161,107161,107177,107177,107776,107777,107778,107792,107793,107794,107808,107809,107810,107812,107813,107814,107840,107842,107846,107848,107848,107849,107850,107850,107862,107864,107865,107866,107872,107874,107876,107877,107878,107878,107880,107882,107903,107913,107929,107940,107941,107942,107945,
108032,108033,108034,108048,108049,108050,108064,108065,108066,108068,108069,108070,108096,108098,108102,108104,108104,108105,108106,108106,108118,108120,108121,108122,108128,108130,108132,108133,108134,108134,108136,108138,108159,108169,108185,108196,108197,108198,108201,108800,108801,108802,108804,108805,108806,108808,108808,108809,108809,108810,108810,108816,108817,108818,108820,108821,108822,108824,108824,108824,108824,108825,108825,108825,108825,108826,108826,108826,108826,108832,108833,108834,108836,108837,108838,108840,108840,108841,108841,108842,108842,108864,108865,108866,108868,108869,108870,108870,108872,108873,108874,108880,108881,108882,108884,108885,108886,108886,108888,108888,
108889,108889,108890,108890,108896,108897,108898,108900,108901,108902,108902,108904,108905,108906,108928,108928,108929,108929,108930,108930,108932,108933,108934,108936,108937,108937,108938,108944,108944,108945,108945,108946,108946,108948,108949,108950,108952,108952,108953,108953,108953,108954,108954,108960,108960,108961,108961,108962,108962,108964,108965,108966,108968,108969,108969,108970,109056,109057,109058,109060,109061,109062,109064,109064,109065,109065,109066,109066,109072,109073,109074,109076,109077,109078,109080,109080,109080,109080,109081,109081,109081,109081,109082,109082,109082,109082,109088,109089,109090,109092,109093,109094,109096,109096,109097,109097,109098,109098,109120,109121,
109122,109124,109125,109126,109126,109128,109129,109130,109136,109137,109138,109140,109141,109142,109142,109144,109144,109145,109145,109146,109146,109152,109153,109154,109156,109157,109158,109158,109160,109161,109162,109184,109184,109185,109185,109186,109186,109188,109189,109190,109192,109193,109193,109194,109200,109200,109201,109201,109202,109202,109204,109205,109206,109208,109208,109209,109209,109209,109210,109210,109216,109216,109217,109217,109218,109218,109220,109221,109222,109224,109225,109225,109226,111067,111079,111323,111335,112067,112075,112083,112091,112099,112107,112323,112331,112339,112347,112355,112363,113095,113111,113127,113347,113351,113355,113363,113367,113371,113379,113383,
113387,131334,131337,131353,131366,131369,131398,131401,131414,131417,131430,131433,131462,131465,131478,131481,131494,131497,131590,131593,131606,131609,131622,131654,131657,131670,131673,131686,131689,131718,131721,131734,131737,131750,131753,132384,132385,132386,132388,132389,132390,132392,132393,132394,132415,132422,132422,132424,132425,132426,132438,132438,132440,132441,132442,132448,132449,132450,132452,132452,132453,132453,132454,132454,132454,132454,132456,132457,132458,132479,132489,132505,132512,132513,132514,132516,132517,132518,132521,132543,132640,132641,132642,132644,132645,132646,132648,132649,132650,132671,132678,132678,132680,132681,132682,132694,132694,132696,132697,132698,
132704,132705,132706,132708,132708,132709,132709,132710,132710,132710,132710,132712,132713,132714,132735,132745,132761,132768,132769,132770,132772,132773,132774,132777,132799,133392,133393,133394,133396,133397,133398,133400,133401,133402,133446,133462,133464,133465,133466,133478,133513,133513,133528,133528,133529,133529,133529,133529,133530,133530,133545,133545,133652,133653,133654,133656,133657,133658,133702,133718,133720,133721,133722,133734,133769,133769,133784,133784,133785,133785,133785,133785,133786,133786,133801,133801,135430,135433,135449,135462,135465,135494,135497,135510,135513,135526,135529,135552,135553,135554,135558,135561,135568,135569,135570,135574,135577,135584,135585,135586,
135590,135593,135686,135689,135702,135705,135718,135750,135753,135766,135769,135782,135785,135808,135809,135814,135817,135824,135825,135830,135833,135840,135841,135846,135849,136480,136481,136482,136484,136485,136486,136488,136489,136490,136511,136518,136518,136534,136534,136544,136545,136546,136548,136548,136549,136549,136550,136550,136550,136550,136575,136577,136585,136593,136601,136608,136609,136609,136610,136612,136613,136614,136617,136639,136736,136737,136738,136740,136741,136742,136744,136745,136746,136767,136774,136774,136790,136790,136800,136801,136802,136804,136804,136805,136805,136806,136806,136806,136806,136831,136833,136841,136849,136857,136864,136865,136865,136866,136868,136869,
136870,136873,136895,137488,137489,137490,137492,137493,137494,137496,137497,137498,137542,137558,137560,137561,137562,137574,137601,137609,137609,137617,137624,137624,137625,137625,137625,137625,137626,137626,137633,137641,137641,137748,137749,137750,137752,137753,137754,137798,137814,137816,137817,137818,137830,137857,137865,137865,137873,137880,137880,137881,137881,137881,137881,137882,137882,137889,137897,137897,139526,139529,139545,139558,139561,139584,139586,139590,139593,139600,139602,139606,139609,139616,139618,139622,139625,139654,139657,139670,139673,139686,139689,139782,139785,139798,139801,139814,139840,139841,139842,139846,139849,139856,139857,139858,139862,139865,139872,139873,
139874,139878,139881,139910,139913,139926,139929,139942,139945,140576,140577,140578,140580,140581,140582,140584,140585,140586,140607,140610,140614,140614,140616,140617,140618,140626,140630,140630,140632,140633,140634,140640,140641,140642,140642,140644,140644,140645,140645,140646,140646,140646,140646,140648,140649,140650,140671,140681,140697,140704,140705,140706,140708,140709,140710,140713,140735,140832,140833,140834,140836,140837,140838,140840,140841,140842,140863,140866,140870,140870,140872,140873,140874,140882,140886,140886,140888,140889,140890,140896,140897,140898,140898,140900,140900,140901,140901,140902,140902,140902,140902,140904,140905,140906,140927,140937,140953,140960,140961,140962,
140964,140965,140966,140969,140991,141584,141585,141586,141588,141589,141590,141592,141593,141594,141634,141638,141650,141654,141656,141657,141658,141666,141670,141705,141705,141720,141720,141721,141721,141721,141721,141722,141722,141737,141737,141844,141845,141846,141848,141849,141850,141890,141894,141906,141910,141912,141913,141914,141922,141926,141961,141961,141976,141976,141977,141977,141977,141977,141978,141978,141993,141993,143835,143847,144091,144103,144835,144839,144843,144851,144855,144859,144867,144871,144875,145091,145095,145099,145107,145111,145115,145123,145127,145131,147712,147713,147714,147728,147729,147730,147737,147744,147745,147746,147750,147782,147782,147798,147798,147814,
147814,147844,147845,147846,147849,147865,147876,147877,147878,147881,147903,147968,147969,147970,147984,147985,147986,147993,148000,148001,148002,148006,148038,148038,148054,148054,148070,148070,148100,148101,148102,148105,148121,148132,148133,148134,148137,148159,148736,148737,148738,148740,148740,148741,148741,148742,148742,148744,148745,148746,148752,148753,148754,148756,148756,148757,148757,148758,148758,148760,148761,148762,148768,148769,148770,148772,148772,148772,148772,148773,148773,148773,148773,148774,148774,148774,148774,148776,148777,148778,148800,148800,148801,148801,148802,148802,148804,148805,148806,148806,148808,148809,148810,148816,148816,148817,148817,148818,148818,148820,
148821,148822,148822,148824,148825,148826,148832,148832,148833,148833,148834,148834,148836,148836,148837,148837,148838,148838,148838,148840,148841,148842,148864,148865,148866,148868,148869,148870,148872,148873,148873,148874,148880,148881,148882,148884,148885,148886,148888,148889,148889,148890,148896,148897,148898,148900,148900,148901,148901,148902,148902,148904,148905,148905,148906,148992,148993,148994,148996,148996,148997,148997,148998,148998,149000,149001,149002,149008,149009,149010,149012,149012,149013,149013,149014,149014,149016,149017,149018,149024,149025,149026,149028,149028,149028,149028,149029,149029,149029,149029,149030,149030,149030,149030,149032,149033,149034,149056,149056,149057,
149057,149058,149058,149060,149061,149062,149062,149064,149065,149066,149072,149072,149073,149073,149074,149074,149076,149077,149078,149078,149080,149081,149082,149088,149088,149089,149089,149090,149090,149092,149092,149093,149093,149094,149094,149094,149096,149097,149098,149120,149121,149122,149124,149125,149126,149128,149129,149129,149130,149136,149137,149138,149140,149141,149142,149144,149145,149145,149146,149152,149153,149154,149156,149156,149157,149157,149158,149158,149160,149161,149161,149162,149760,149761,149762,149764,149766,149776,149777,149778,149780,149782,149784,149785,149786,149792,149793,149794,149796,149798,149830,149846,149848,149849,149850,149862,149888,149889,149892,149892,
149892,149893,149893,149894,149894,149897,149904,149905,149908,149908,149909,149910,149912,149913,149913,149914,149924,149924,149925,149926,149926,149929,149951,150016,150017,150018,150020,150022,150032,150033,150034,150036,150038,150040,150041,150042,150048,150049,150050,150052,150054,150086,150102,150104,150105,150106,150118,150144,150145,150148,150148,150148,150149,150149,150150,150150,150153,150160,150161,150164,150164,150165,150166,150168,150169,150169,150170,150180,150180,150181,150182,150182,150185,150207,151833,151846,151878,151878,151894,151894,151910,151910,151936,151937,151938,151940,151941,151942,151945,151952,151953,151954,151961,151968,151969,151970,151972,151973,151974,151977,
151999,152064,152065,152066,152080,152081,152082,152089,152096,152097,152098,152102,152134,152134,152150,152150,152166,152166,152192,152193,152194,152196,152197,152198,152201,152208,152209,152210,152217,152224,152225,152226,152228,152229,152230,152233,152255,152832,152833,152834,152836,152836,152837,152837,152838,152838,152840,152841,152842,152848,152849,152850,152852,152852,152853,152853,152854,152854,152856,152857,152858,152864,152865,152866,152868,152868,152868,152868,152869,152869,152869,152869,152870,152870,152870,152870,152872,152873,152874,152896,152896,152897,152897,152898,152898,152900,152901,152902,152902,152904,152905,152906,152912,152912,152913,152913,152914,152914,152916,152917,
152918,152918,152920,152921,152922,152928,152928,152929,152929,152930,152930,152932,152932,152933,152933,152934,152934,152934,152936,152937,152938,152960,152961,152962,152964,152965,152966,152968,152969,152969,152970,152976,152977,152978,152980,152981,152982,152984,152985,152985,152986,152992,152993,152994,152996,152996,152997,152997,152998,152998,153000,153001,153001,153002,153088,153089,153090,153092,153092,153093,153093,153094,153094,153096,153097,153098,153104,153105,153106,153108,153108,153109,153109,153110,153110,153112,153113,153114,153120,153121,153122,153124,153124,153124,153124,153125,153125,153125,153125,153126,153126,153126,153126,153128,153129,153130,153152,153152,153153,153153,
153154,153154,153156,153157,153158,153158,153160,153161,153162,153168,153168,153169,153169,153170,153170,153172,153173,153174,153174,153176,153177,153178,153184,153184,153185,153185,153186,153186,153188,153188,153189,153189,153190,153190,153190,153192,153193,153194,153216,153217,153218,153220,153221,153222,153224,153225,153225,153226,153232,153233,153234,153236,153237,153238,153240,153241,153241,153242,153248,153249,153250,153252,153252,153253,153253,153254,153254,153256,153257,153257,153258,153856,153857,153858,153872,153873,153874,153880,153881,153882,153888,153889,153890,153926,153942,153944,153945,153946,153958,153984,153985,153988,153988,153989,153989,153990,153993,154000,154001,154004,
154005,154008,154009,154009,154010,154020,154021,154022,154025,154047,154112,154113,154114,154128,154129,154130,154136,154137,154138,154144,154145,154146,154182,154198,154200,154201,154202,154214,154240,154241,154244,154244,154245,154245,154246,154249,154256,154257,154260,154261,154264,154265,154265,154266,154276,154277,154278,154281,154303,155904,155905,155906,155908,155909,155910,155912,155913,155914,155920,155921,155922,155924,155925,155926,155928,155929,155929,155930,155936,155937,155938,155940,155941,155942,155942,155944,155945,155946,155967,155968,155969,155970,155972,155972,155973,155973,155974,155974,155974,155974,155976,155977,155978,155984,155985,155986,155988,155988,155989,155989,
155990,155990,155990,155990,155992,155993,155994,156000,156001,156002,156004,156004,156005,156005,156006,156006,156006,156006,156008,156009,156010,156031,156036,156037,156038,156041,156057,156068,156069,156070,156073,156095,156095,156160,156161,156162,156164,156165,156166,156168,156169,156170,156176,156177,156178,156180,156181,156182,156184,156185,156185,156186,156192,156193,156194,156196,156197,156198,156198,156200,156201,156202,156223,156224,156225,156226,156228,156228,156229,156229,156230,156230,156230,156230,156232,156233,156234,156240,156241,156242,156244,156244,156245,156245,156246,156246,156246,156246,156248,156249,156250,156256,156257,156258,156260,156260,156261,156261,156262,156262,
156262,156262,156264,156265,156266,156292,156293,156294,156297,156313,156324,156325,156326,156329,156351,156351,156928,156929,156930,156932,156932,156933,156933,156934,156934,156936,156937,156938,156944,156945,156946,156948,156948,156949,156949,156950,156950,156952,156953,156954,156960,156961,156962,156964,156964,156964,156964,156965,156965,156965,156965,156966,156966,156966,156966,156968,156969,156970,156991,156992,156992,156992,156992,156993,156993,156993,156993,156994,156994,156994,156994,156996,156996,156997,156997,156998,156998,156998,157000,157000,157001,157001,157002,157002,157008,157008,157008,157008,157009,157009,157009,157009,157010,157010,157010,157010,157012,157012,157013,157013,
157014,157014,157014,157016,157016,157017,157017,157018,157018,157024,157024,157024,157024,157025,157025,157025,157025,157026,157026,157026,157026,157028,157028,157028,157029,157029,157029,157030,157030,157030,157030,157032,157032,157033,157033,157034,157034,157055,157056,157057,157058,157060,157061,157062,157064,157065,157065,157066,157072,157073,157074,157076,157077,157078,157080,157081,157081,157082,157088,157089,157090,157092,157092,157093,157093,157094,157094,157096,157097,157097,157098,157119,157184,157185,157186,157188,157188,157189,157189,157190,157190,157192,157193,157194,157200,157201,157202,157204,157204,157205,157205,157206,157206,157208,157209,157210,157216,157217,157218,157220,
157220,157220,157220,157221,157221,157221,157221,157222,157222,157222,157222,157224,157225,157226,157247,157248,157248,157248,157248,157249,157249,157249,157249,157250,157250,157250,157250,157252,157252,157253,157253,157254,157254,157254,157256,157256,157257,157257,157258,157258,157264,157264,157264,157264,157265,157265,157265,157265,157266,157266,157266,157266,157268,157268,157269,157269,157270,157270,157270,157272,157272,157273,157273,157274,157274,157280,157280,157280,157280,157281,157281,157281,157281,157282,157282,157282,157282,157284,157284,157284,157285,157285,157285,157286,157286,157286,157286,157288,157288,157289,157289,157290,157290,157312,157313,157314,157316,157317,157318,157320,
157321,157321,157322,157328,157329,157330,157332,157333,157334,157336,157337,157337,157338,157344,157345,157346,157348,157348,157349,157349,157350,157350,157352,157353,157353,157354,157375,157952,157953,157954,157956,157958,157968,157969,157970,157972,157974,157976,157977,157978,157984,157985,157986,157988,157990,158015,158016,158017,158018,158020,158021,158022,158022,158024,158025,158026,158032,158033,158034,158036,158037,158038,158038,158040,158040,158041,158041,158042,158042,158048,158049,158050,158052,158053,158054,158054,158056,158057,158058,158079,158080,158081,158084,158084,158084,158085,158085,158086,158086,158089,158096,158097,158100,158100,158101,158102,158104,158105,158105,158106,
158116,158116,158117,158118,158118,158121,158143,158143,158208,158209,158210,158212,158214,158224,158225,158226,158228,158230,158232,158233,158234,158240,158241,158242,158244,158246,158271,158272,158273,158274,158276,158277,158278,158278,158280,158281,158282,158288,158289,158290,158292,158293,158294,158294,158296,158296,158297,158297,158298,158298,158304,158305,158306,158308,158309,158310,158310,158312,158313,158314,158335,158336,158337,158340,158340,158340,158341,158341,158342,158342,158345,158352,158353,158356,158356,158357,158358,158360,158361,158361,158362,158372,158372,158373,158374,158374,158377,158399,158399,160219,160231,160475,160487,161219,161223,161227,161235,161239,161243,161251,
161255,161259,161483,161499,161515,162243,162247,162259,162263,162275,162279,162499,162503,162515,162519,162531,162535,164121,164134,164166,164182,164198,164223,164233,164233,164249,164249,164265,164265,164377,164390,164422,164438,164454,164479,164489,164489,164505,164505,164521,164521,165128,165129,165144,165145,165156,165157,165158,165160,165161,165184,165186,165190,165192,165192,165192,165193,165193,165194,165194,165206,165208,165208,165209,165209,165210,165216,165218,165220,165221,165222,165222,165224,165224,165224,165225,165225,165226,165226,165247,165257,165273,165284,165285,165286,165289,165384,165385,165400,165401,165412,165413,165414,165416,165417,165440,165442,165446,165448,165448,
165448,165449,165449,165450,165450,165462,165464,165464,165465,165465,165466,165472,165474,165476,165477,165478,165478,165480,165480,165480,165481,165481,165482,165482,165503,165513,165529,165540,165541,165542,165545,166168,166168,166169,166169,166170,166170,166214,166230,166232,166233,166234,166246,166281,166296,166297,166297,166298,166313,166424,166424,166425,166425,166426,166426,166470,166486,166488,166489,166490,166502,166537,166552,166553,166553,166554,166569,168217,168230,168255,168262,168278,168294,168319,168319,168320,168321,168322,168324,168325,168326,168328,168328,168329,168329,168329,168329,168330,168330,168336,168337,168338,168340,168341,168342,168344,168344,168345,168345,168345,
168345,168346,168346,168352,168353,168354,168356,168357,168358,168360,168360,168361,168361,168361,168361,168362,168362,168473,168486,168511,168518,168534,168550,168575,168575,168576,168577,168578,168580,168581,168582,168584,168584,168585,168585,168585,168585,168586,168586,168592,168593,168594,168596,168597,168598,168600,168600,168601,168601,168601,168601,168602,168602,168608,168609,168610,168612,168613,168614,168616,168616,168617,168617,168617,168617,168618,168618,168639,169224,169225,169240,169241,169252,169253,169254,169256,169257,169279,169280,169282,169286,169288,169288,169289,169290,169302,169304,169305,169312,169314,169316,169317,169318,169318,169320,169320,169321,169322,169343,169343,
169344,169345,169346,169348,169349,169350,169352,169353,169353,169354,169360,169361,169362,169364,169365,169366,169368,169369,169369,169370,169376,169377,169378,169380,169380,169381,169381,169382,169382,169384,169385,169385,169386,169407,169480,169481,169496,169497,169508,169509,169510,169512,169513,169535,169536,169538,169542,169544,169544,169545,169546,169558,169560,169561,169568,169570,169572,169573,169574,169574,169576,169576,169577,169578,169599,169599,169600,169601,169602,169604,169605,169606,169608,169609,169609,169610,169616,169617,169618,169620,169621,169622,169624,169625,169625,169626,169632,169633,169634,169636,169636,169637,169637,169638,169638,169640,169641,169641,169642,169663,
170264,170264,170265,170265,170266,170266,170303,170310,170326,170328,170329,170330,170342,170367,170368,170368,170369,170369,170370,170370,170372,170373,170374,170376,170377,170377,170378,170384,170384,170385,170385,170386,170386,170388,170389,170390,170392,170392,170393,170393,170393,170394,170394,170400,170400,170401,170401,170402,170402,170404,170405,170406,170408,170409,170409,170410,170520,170520,170521,170521,170522,170522,170559,170566,170582,170584,170585,170586,170598,170623,170624,170624,170625,170625,170626,170626,170628,170629,170630,170632,170633,170633,170634,170640,170640,170641,170641,170642,170642,170644,170645,170646,170648,170648,170649,170649,170649,170650,170650,170656,
170656,170657,170657,170658,170658,170660,170661,170662,170664,170665,170665,170666,170687,172313,172326,172352,172353,172354,172358,172368,172369,172370,172374,172384,172385,172386,172390,172415,172425,172425,172441,172441,172457,172457,172569,172582,172608,172609,172610,172614,172624,172625,172626,172630,172640,172641,172642,172646,172671,172681,172681,172697,172697,172713,172713,173348,173349,173350,173376,173378,173382,173384,173384,173385,173386,173386,173398,173400,173401,173402,173408,173410,173412,173413,173414,173414,173416,173416,173417,173418,173418,173439,173449,173465,173476,173477,173478,173481,173604,173605,173606,173632,173634,173638,173640,173640,173641,173642,173642,173654,
173656,173657,173658,173664,173666,173668,173669,173670,173670,173672,173672,173673,173674,173674,173695,173705,173721,173732,173733,173734,173737,174360,174360,174361,174361,174362,174362,174406,174422,174424,174425,174426,174438,174473,174488,174489,174489,174490,174505,174616,174616,174617,174617,174618,174618,174662,174678,174680,174681,174682,174694,174729,174744,174745,174745,174746,174761,176603,176615,176859,176871,177603,177603,177607,177611,177611,177619,177619,177623,177627,177627,177635,177635,177639,177643,177643,177859,177859,177863,177867,177867,177875,177875,177879,177883,177883,177891,177891,177895,177899,177899,200050,200054,200056,200057,200058,200058,200113,200116,200117,
200117,200118,200306,200312,200313,200314,200314,200369,200372,200373,200373,200374,200377,204146,204150,204152,204153,204154,204154,204209,204212,204213,204213,204214,204402,204408,204409,204410,204410,204465,204468,204469,204469,204470,204473,208242,208246,208248,208249,208250,208250,208305,208308,208309,208309,208310,208498,208504,208505,208506,208506,208561,208564,208565,208565,208566,208569,216434,216438,216442,216497,216500,216501,216501,216502,216505,216690,216698,216753,216756,216757,216757,216758,216761,220530,220534,220538,220593,220596,220597,220597,220598,220601,220786,220794,220849,220852,220853,220853,220854,220857,224560,224561,224562,224564,224565,224566,224568,224569,224570,
224626,224630,224634,224689,224692,224693,224693,224694,224697,224816,224817,224818,224820,224821,224822,224824,224825,224826,224882,224890,224945,224948,224949,224949,224950,224953,232818,232822,232824,232825,232826,232826,232881,232885,233074,233078,233080,233081,233082,233082,233137,233141,233145,236848,236849,236850,236852,236853,236854,236856,236857,236858,236914,236918,236920,236921,236922,236922,236977,236981,237104,237105,237106,237108,237109,237110,237112,237113,237114,237170,237174,237176,237177,237178,237178,237233,237237,237241,241010,241014,241016,241017,241018,241018,241073,241077,241266,241270,241272,241273,241274,241274,241329,241333,241337,258328,258329,258330,258340,258341,
258342,258370,258386,258392,258393,258394,258402,258404,258405,258406,258433,258449,258456,258457,258458,258465,258468,258469,258470,258584,258585,258586,258596,258597,258598,258626,258642,258648,258649,258650,258658,258660,258661,258662,258689,258705,258712,258713,258714,258721,258724,258725,258726,259336,259337,259338,259352,259352,259353,259353,259354,259354,259364,259365,259366,259368,259369,259370,259394,259400,259401,259402,259410,259416,259416,259417,259417,259418,259418,259426,259428,259429,259430,259432,259433,259434,259457,259473,259480,259481,259482,259489,259492,259493,259494,259592,259593,259594,259608,259608,259609,259609,259610,259610,259624,259625,259626,259650,259656,259657,
259658,259666,259672,259672,259673,259673,259674,259674,259682,259688,259689,259690,259713,259729,259736,259737,259738,259745,259748,259749,259750,260356,260357,260358,260372,260373,260374,260388,260388,260389,260389,260390,260390,260418,260434,260440,260441,260442,260450,260452,260453,260454,260481,260484,260485,260486,260497,260500,260501,260502,260513,260516,260516,260517,260517,260518,260518,260612,260613,260614,260628,260629,260630,260632,260633,260634,260644,260644,260645,260645,260646,260646,260674,260690,260696,260697,260698,260706,260708,260709,260710,260737,260740,260741,260742,260753,260756,260757,260758,260760,260761,260762,260769,260772,260772,260773,260773,260774,260774};

int rorw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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};


int getcode(int x,int y, int* BD){
	if (x<0 || x>= board_size || y<0 || y>= board_size) return 3;
	else return BD[POS(x,y)];
}

bool searchCode(int code){
	int l=0;
	int r=7800-1;
	while (l<=r){
		int t= (l+r)/2;
		if (code == codes[t]) return rorw[t];
		else if (code < codes[t]) r=t-1;
		else if (code > codes[t]) l=t+1;
	}
	return false;
}

bool pattern(int x, int y, int* BD){
	int muti=1;
	int code=0;
	for (int i=-1;i<=1;i++)
		for (int j=-1;j<=1;j++){
			code += muti*getcode(x+i,y+j,BD);
			muti*=4;
			
		}
	//printf("%d\n",code);
	return searchCode(code);
}
int matchpattern(int x, int y, int color, int *BD){
	if (BD[POS(x,y)] != EMPTY)
		return 0;
	BD[POS(x,y)] = color;
	int result = pattern(x,y,BD);
	BD[POS(x,y)] = EMPTY;
	return result;
}
